package com.qf.filters;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.exception.ZuulException;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.stereotype.Component;

@Component
public class MyPreFilter01  extends ZuulFilter {


//    返回一个过滤器类型
    @Override
    public String filterType() {
//        前置类型
        return FilterConstants.PRE_TYPE;
    }

//    过滤器的顺序
    @Override
    public int filterOrder() {
//        从小到大
        return 1;
    }

//    是否启用当前过滤器
    @Override
    public boolean shouldFilter() {
        return true;
    }

//    过滤器要做的事情
    @Override
    public Object run() throws ZuulException {
        System.out.println("MyPreFilter01执行了");
        return null;
    }
}
